package com.example.demo.request;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Min;
import javax.validation.constraints.Max;

public class CreateDataSourceConfigRequest {
    
    @NotBlank(message = "数据源名称不能为空")
    private String name;                    // 数据源名称
    
    @NotBlank(message = "数据库类型不能为空")
    private String dbType;                  // 数据库类型：MySQL, PostgreSQL
    
    @NotBlank(message = "主机地址不能为空")
    private String host;                    // 主机地址
    
    @NotNull(message = "端口号不能为空")
    @Min(value = 1, message = "端口号必须大于0")
    @Max(value = 65535, message = "端口号不能超过65535")
    private Integer port;                   // 端口号
    
    @NotBlank(message = "用户名不能为空")
    private String username;                // 用户名
    
    @NotBlank(message = "密码不能为空")
    private String password;                // 密码（明文，后端会加密）
    
    @NotBlank(message = "数据库名称不能为空")
    private String databaseName;            // 数据库名称
    
    @NotBlank(message = "查询SQL不能为空")
    private String querySql;                // 用于获取数据的查询SQL
    
    @NotBlank(message = "ID字段配置不能为空")
    private String idFields;                // 用于生成任务唯一ID的源字段数组，JSON格式
    
    @NotBlank(message = "展示字段配置不能为空")
    private String displayFields;           // 需要在前端展示的列名数组，JSON格式
    
    private String extraFields;             // 需要额外添加的字段，JSON格式
    
    private Integer status = 1;             // 状态：1=启用，0=禁用，默认启用

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDbType() {
        return dbType;
    }

    public void setDbType(String dbType) {
        this.dbType = dbType;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDatabaseName() {
        return databaseName;
    }

    public void setDatabaseName(String databaseName) {
        this.databaseName = databaseName;
    }

    public String getQuerySql() {
        return querySql;
    }

    public void setQuerySql(String querySql) {
        this.querySql = querySql;
    }

    public String getIdFields() {
        return idFields;
    }

    public void setIdFields(String idFields) {
        this.idFields = idFields;
    }

    public String getDisplayFields() {
        return displayFields;
    }

    public void setDisplayFields(String displayFields) {
        this.displayFields = displayFields;
    }

    public String getExtraFields() {
        return extraFields;
    }

    public void setExtraFields(String extraFields) {
        this.extraFields = extraFields;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
}